/*
 * spi.h
 *
 *  Created on: 27/mar/2014
 *      Author: robotis
 */

#ifndef SPI_H_
#define SPI_H_


#define CE1_ACTIVE				P2OUT |= BIT3	/// P2.3 UCB0STE verso sensore colore
#define CE2_ACTIVE				P2OUT |= BIT6	/// P2.6 UCB1STE verso Gyro

/// P2.3 e P2.6  = 0  :  1011 0111
#define CE1_INACTIVE       		P2OUT &= 0xF7
#define CE2_INACTIVE       		P2OUT &= 0xBF

/// formato dei comandi al giroscopio
/// R/W CW/CCW asse centrale
/// due byte di scrittura o lettura
#define CW						(1 << 6)
#define CCW						0
#define	READ					(1 << 7)
#define WRITE					0
#define AC						(1 << 5)


void setUCB0_4Wire(void);
void B0tx_Gyro(unsigned char val);
void B0tx_Color(unsigned char val);

#endif /* SPI_H_ */
